<?php
namespace app\front\service\v2;
use app\front\service\GetMsgService;
class Statistics extends GetMsgService
{
    private static $_instance;
    
    //private 构造函数
    private function __construct() {
       // echo " I'm construct! process id is " . getmypid() . " and thread id is " . Thread::getCurrentThreadId() . "\n";
    }
    
    private function __clone() {
    //    echo " I'm clone! process id is " . getmypid() . " and thread id is " . Thread::getCurrentThreadId() . "\n";
    }
    
    //单例方法访问类实例
    public static function getInstance() {
        if (!(self::$_instance instanceof self)) {
            self::$_instance = new self();
        }
        return self::$_instance;
    }  
    
  
    /**
    * 函数用途描述 :写入当年分公司统计记录
    * @date: 2018年6月11日 下午10:07:24
    * @author: 孙洪亮
    * @param:  null
    * @return: null
    */
    public function insertThisYearFilialeIncomeStatistics(){
        $filiale_data=$this->getAllFilialeMsg();
        for($i=0;$i<count($filiale_data);$i++){
            $income=0;
            for($j=1;$j<13;$j++){
                $MonthTurnover= $this->GetThisMonthTurnover( $filiale_data[$i]['id'],$j);
                $income=bcadd($income,$MonthTurnover,3);
                $this->insertStatistics($j,$filiale_data[$i], $MonthTurnover,$income);
            }
        }
    }
    
  
}


